import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:glass_kit/glass_kit.dart';
import 'package:todo_project/color.dart';

class GlassTitleCard extends StatelessWidget {
  Widget child;
  String title;
  List<Widget>? titleActions;

  GlassTitleCard(
      {Key? key, required this.child, required this.title, this.titleActions})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Positioned(
          top: 56.w,
          left: 0,
          right: 0,
          bottom: 0,
          child: Container(
            decoration: BoxDecoration(
                color: Colors.white, borderRadius: BorderRadius.circular(8.w)),
          ),
        ),
        Positioned(
          top: 0,
          left: 0,
          right: 0,
          bottom: 0,
          child: GlassContainer.clearGlass(
            borderRadius: BorderRadius.circular(8.w),
            width: double.infinity,
            height: double.infinity,
            borderWidth: 0,
            gradient: const LinearGradient(
                colors: [Colors.white24, Colors.white],
                begin: Alignment.topCenter,
                end: Alignment.bottomCenter),
            padding: EdgeInsets.symmetric(
              horizontal: 12.w,
            ).copyWith(top: 15.w),
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Expanded(
                  child: Text(
                    title,
                    style: TextStyle(
                        color: AppColor.textColor,
                        fontSize: 16.sp,
                        fontWeight: FontWeight.w600),
                  ),
                ),
                Row(
                  children: titleActions ?? [],
                )
              ],
            ),
          ),
        ),
        Container(
          margin: EdgeInsets.only(top: 56.w),
          child: child,
          width: double.infinity,
        )
      ],
    );
  }
}
